﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpineScaler : MonoBehaviour
{
    void Update()
    {
        if (!Utils.IsOnUI(AppMgr.Instance.mainUI.graphicRaycaster, Input.mousePosition))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.gameObject == gameObject)
                {
                    float mouseScroll = Input.GetAxis("Mouse ScrollWheel") * 5 * Time.deltaTime * transform.localScale.y;
                    if (mouseScroll != 0)
                    {
                        transform.localScale *= 1 + mouseScroll;
                        SpineCreateControl.Instance.UpdateCurrentSpineObject(gameObject);
                    }
                }
            }
        }
    }
}
